//
// Copyright (c) 2009 All Right Reserved
//
// vl
//
// 2009-01-01
// Contains ...
using System.Text;
namespace LargoCommon.Music {
///
/// Musical Area.
///
public class MusicalSection { //// struct
#region Constructors
///
/// Initializes a new instance of the MusicalSection class.
///
/// From bar number.
/// To bar number.
/// Name of the area.
public MusicalSection(int barFrom, int barTo, string name) : this() {
this.Name = name;
this.BarFrom = barFrom;
this.BarTo = barTo;
}
///
/// Prevents a default instance of the class from being created.
///
private MusicalSection() {
}
#endregion
#region Properties
///
/// Gets the bar from.
///
///
/// The bar from.
///
public int BarFrom { get; }
///
/// Gets or sets the bar to.
///
///
/// The bar to.
///
public int BarTo { get; set; }
///
/// Gets the number of bars.
///
/// Property description.
public int Length => this.BarTo - this.BarFrom + 1;
///
/// Gets the name.
///
///
/// The name of area.
///
private string Name { get; }
#endregion
#region String representation
/// String representation of the object.
/// Returns value.
public override string ToString() {
var s = new StringBuilder();
s.AppendFormat("{0,4} - {1,4}", this.BarFrom, this.BarTo);
s.Append(this.Name);
return s.ToString();
}
#endregion
}
}